home *** CD-ROM | disk | FTP | other *** search
- Path: news.onramp.net!usenet
- From: dekorte@suite.com (Steve Dekorte)
- Newsgroups: comp.lang.c,comp.lang.objective-c
- Subject: Re: Comma Delimited function wanted
- Date: 13 Jan 1996 02:44:57 GMT
- Organization: On-Ramp; Individual Internet Connections; Dallas/Ft Worth/Houston, TX USA
- Message-ID: <4d76b9$sk9@news.onramp.net>
- References: <4d3360$kg3@tahko.lpr.carel.fi>
- NNTP-Posting-Host: s172-10.suite.com
-
- aril@cmt.lpr.mail.carel.fi (Ari Lukumies) writes:
- >Help with a comma delimited function needed.
-
- In Objective-C, you might have use something like the following method in your String class;
-
- - setList:aList toSelfDelimitedStringValue:(char *)astring
- {
- char *p;
- id newString = [[String alloc] init];
-
- if ( p = rindex ( [self stringValue], '\n')) { *p = '\0'; }
-
- p = strtok((char *)[self stringValue], astring);
- if (p) { [newString setStringValue:p];}
- [aList addObject:newString];
-
- while (p)
- {
- p = strtok (NULL, astring);
- if (p)
- {
- newString = [[String alloc] init];
- [newString setStringValue:p];
- [aList addObject:newString];
- }
- }
- return self;
- }
-
- --
- Steve Dekorte
- Objective-C/NEXTSTEP developer
- http://www.marble.com/~dekorte
- NeXTmail, MIME welcome.
-